using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._ChangeDetection
{
    /// <summary>
    /// <para>Analyze Changes Using LandTrendr</para>
    /// <para>Evaluates changes in pixel values over time using the Landsat-based detection of trends in disturbance and recovery (LandTrendr) method and generates a change analysis raster containing the model results.</para>
    /// <para>使用基于 Landsat 的干扰和恢复趋势检测 （LandTrendr） 方法评估像素值随时间的变化，并生成包含模型结果的变化分析栅格。</para>
    /// </summary>    
    [DisplayName("Analyze Changes Using LandTrendr")]
    public class AnalyzeChangesUsingLandTrendr : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public AnalyzeChangesUsingLandTrendr()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_multidimensional_raster">
        /// <para>Input Multidimensional Raster</para>
        /// <para>The input multidimensional raster dataset.</para>
        /// <para>输入多维栅格数据集。</para>
        /// </param>
        /// <param name="_out_multidimensional_raster">
        /// <para>Output Multidimensional Raster</para>
        /// <para><xdoc>
        ///   <para>The output Cloud Raster Format (CRF) multidimensional raster dataset.</para>
        ///   <para>The output change analysis raster containing model information from the LandTrendr analysis.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出云栅格格式 （CRF） 多维栅格数据集。</para>
        ///   <para>输出变化分析栅格，其中包含来自 LandTrendr 分析的模型信息。</para>
        /// </xdoc></para>
        /// </param>
        public AnalyzeChangesUsingLandTrendr(object _in_multidimensional_raster, object _out_multidimensional_raster)
        {
            this._in_multidimensional_raster = _in_multidimensional_raster;
            this._out_multidimensional_raster = _out_multidimensional_raster;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Analyze Changes Using LandTrendr";

        public override string CallName => "ia.AnalyzeChangesUsingLandTrendr";

        public override List<string> AcceptEnvironments => ["cellSize", "compression", "configKeyword", "extent", "geographicTransformations", "nodata", "outputCoordinateSystem", "parallelProcessingFactor", "pyramid", "rasterStatistics", "resamplingMethod", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_multidimensional_raster, _out_multidimensional_raster, _processing_band, _snapping_date, _max_num_segments, _vertex_count_overshoot, _spike_threshold, _recovery_threshold, _prevent_one_year_recovery.GetGPValue(), _recovery_trend.GetGPValue(), _min_num_observations, _best_model_proportion, _pvalue_threshold, _output_other_bands.GetGPValue()];

        /// <summary>
        /// <para>Input Multidimensional Raster</para>
        /// <para>The input multidimensional raster dataset.</para>
        /// <para>输入多维栅格数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Multidimensional Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_multidimensional_raster { get; set; }


        /// <summary>
        /// <para>Output Multidimensional Raster</para>
        /// <para><xdoc>
        ///   <para>The output Cloud Raster Format (CRF) multidimensional raster dataset.</para>
        ///   <para>The output change analysis raster containing model information from the LandTrendr analysis.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出云栅格格式 （CRF） 多维栅格数据集。</para>
        ///   <para>输出变化分析栅格，其中包含来自 LandTrendr 分析的模型信息。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Multidimensional Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_multidimensional_raster { get; set; }


        /// <summary>
        /// <para>Processing Band Name</para>
        /// <para><xdoc>
        ///   <para>The image band name to use for segmenting the pixel value trajectories over time. Choose the band name that will best capture the changes in the feature you want to observe.</para>
        ///   <para>If no band value is specified and the input is multiband imagery, the first band in the multiband image will be used.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于分割像素值随时间变化的轨迹的图像波段名称。选择最能捕捉要观察的特征变化的波段名称。</para>
        ///   <para>如果未指定波段值且输入为多波段影像，则将使用多波段影像中的第一个波段。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Processing Band Name")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _processing_band { get; set; } = null;


        /// <summary>
        /// <para>Snapping Date</para>
        /// <para><xdoc>
        ///   <para>The date used to identify a slice for each year in the input multidimensional dataset. The slice with the date closest to the snapping date will be used. This parameter is required if the input dataset contains sub-yearly data.</para>
        ///   <para>The default is 06-30, or June 30, which is approximately midway through a calendar year.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于标识输入多维数据集中每年的切片的日期。将使用日期最接近捕捉日期的切片。如果输入数据集包含次年数据，则此参数为必填项。</para>
        ///   <para>默认值为 06-30 或 6 月 30 日，大约是日历年的中途。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Snapping Date")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _snapping_date { get; set; } = null;


        /// <summary>
        /// <para>Maximum Number of Segments</para>
        /// <para>The maximum number of segments to be fitted to the time series for each pixel. The default is 5.</para>
        /// <para>要拟合到每个像素的时间序列的最大线段数。默认值为 5。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Number of Segments")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_num_segments { get; set; } = 5;


        /// <summary>
        /// <para>Vertex Count Overshoot Threshold</para>
        /// <para>The number of additional vertices beyond max_num_segments + 1 that can be used to fit the model during the initial stage of identifying vertices. Later in the modeling process, the number of additional vertices will be reduced to max_num_segments + 1. The default is 2.</para>
        /// <para>在识别顶点的初始阶段，可用于拟合模型的超出 max_num_segments + 1 的附加顶点数。在建模过程的后期，附加顶点的数量将减少到 max_num_segments + 1。默认值为 2。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Vertex Count Overshoot Threshold")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _vertex_count_overshoot { get; set; } = 2;


        /// <summary>
        /// <para>Spike Threshold</para>
        /// <para>The threshold to use for dampening spikes or anomalies in the pixel value trajectory. The value must range between 0 and 1 in which 1 means no dampening. The default is 0.9.</para>
        /// <para>用于抑制像素值轨迹中的峰值或异常的阈值。该值必须在 0 和 1 之间，其中 1 表示无阻尼。默认值为 0.9。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Spike Threshold")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _spike_threshold { get; set; } = 0.9;


        /// <summary>
        /// <para>Recovery Threshold</para>
        /// <para>The recovery threshold value in years. If a segment has a recovery rate that is faster than 1/recovery threshold, the segment is discarded and not included in the time series model. The value must range between 0 and 1. The default is 0.25.</para>
        /// <para>恢复阈值（以年为单位）。如果段的恢复速率快于 1/恢复阈值，则该段将被丢弃，并且不包括在时序模型中。该值的范围必须介于 0 和 1 之间。默认值为 0.25。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Recovery Threshold")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _recovery_threshold { get; set; } = 0.25;


        /// <summary>
        /// <para>Prevent One Year Recovery</para>
        /// <para><xdoc>
        ///   <para>Specifies whether segments that exhibit a one year recovery will be excluded.
        ///   <bulletList>
        ///     <bullet_item>Checked—Segments that exhibit a one year recovery will be excluded. This is the default.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—Segments that exhibit a one year recovery will be not be excluded.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定是否排除显示一年恢复的区段。
        ///   <bulletList>
        ///     <bullet_item>选中 - 将排除显示一年恢复的区段。这是默认设置。 </bullet_item><para/>
        ///     <bullet_item>未选中 - 不会排除显示一年恢复的区段。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Prevent One Year Recovery")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _prevent_one_year_recovery_value _prevent_one_year_recovery { get; set; } = _prevent_one_year_recovery_value._true;

        public enum _prevent_one_year_recovery_value
        {
            /// <summary>
            /// <para>PREVENT_ONE_YEAR_RECOVERY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("PREVENT_ONE_YEAR_RECOVERY")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>ALLOW_ONE_YEAR_RECOVERY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ALLOW_ONE_YEAR_RECOVERY")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Recovery Has Increasing Trend</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the recovery has an increasing (positive) trend.
        ///   <bulletList>
        ///     <bullet_item>Checked—The recovery has an increasing trend. This is the default.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—The recovery has a decreasing trend.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定恢复是否具有增加（正）趋势。
        ///   <bulletList>
        ///     <bullet_item>选中 - 恢复呈上升趋势。这是默认设置。 </bullet_item><para/>
        ///     <bullet_item>未选中 - 恢复呈下降趋势。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Recovery Has Increasing Trend")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _recovery_trend_value _recovery_trend { get; set; } = _recovery_trend_value._true;

        public enum _recovery_trend_value
        {
            /// <summary>
            /// <para>INCREASING_TREND</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("INCREASING_TREND")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>DECREASING_TREND</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DECREASING_TREND")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Minimum Number of Observations</para>
        /// <para>The minimum number of valid observations required to perform fitting. The number of years in the input multidimensional dataset must be equal to or greater than this value. The default is 6.</para>
        /// <para>执行拟合所需的最小有效观测值数。输入多维数据集中的年数必须等于或大于此值。默认值为 6。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Number of Observations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _min_num_observations { get; set; } = 6;


        /// <summary>
        /// <para>Best Model Proportion</para>
        /// <para>The best model proportion value. During the model selection process, the tool will calculate the p-value for each model and identify a model that has the most vertices while maintaining the smallest (most significant) p-value based on this proportion value. A value of 1 means the model has the lowest p-value but may not have a high number of vertices. The default is 1.25.</para>
        /// <para>最佳模型比例值。在模型选择过程中，该工具将计算每个模型的 p 值，并识别具有最多顶点的模型，同时根据此比例值保持最小（最有效）的 p 值。值为 1 表示模型具有最低的 p 值，但可能没有大量折点。默认值为 1.25。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Best Model Proportion")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _best_model_proportion { get; set; } = 1.25;


        /// <summary>
        /// <para>P-Value Threshold</para>
        /// <para>The p-value threshold for a model to be selected. After the vertices are detected in the initial stage of the model fitting, the tool will fit each segment and calculate the p-value to determine the significance of the model. On the next iteration, the model will decrease the number of segments by one and recalculate the p-value. This will continue and, if the p-value is smaller than the value specified in this parameter, the model will be selected and the tool will stop searching for a better model. If no such model is selected, the tool will select a model with a p-value smaller than the lowest p-value × best model proportion value. The default is 0.01.</para>
        /// <para>要选择的模型的 p 值阈值。在模型拟合的初始阶段检测到顶点后，该工具将对每个线段进行拟合并计算 p 值以确定模型的显著性。在下一次迭代中，模型将段数减少 1 并重新计算 p 值。此操作将继续执行，如果 p 值小于此参数中指定的值，则将选择模型，并且工具将停止搜索更好的模型。如果未选择此类模型，则该工具将选择 p 值小于最低 p 值×最佳模型比例值的模型。默认值为 0.01。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("P-Value Threshold")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _pvalue_threshold { get; set; } = 0.01;


        /// <summary>
        /// <para>Include Other Bands</para>
        /// <para><xdoc>
        ///   <para>Specifies whether other bands will be included in the results.
        ///   <bulletList>
        ///     <bullet_item>Checked—Other bands will be included in the results. The segmentation and vertices information from the initial segmentation band specified in the Processing Band parameter will also be fitted to the remaining bands in the multiband images. The model results will include the segmentation band first, then the remaining bands.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—Other bands will not be included in the results. This is the default.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定结果中是否包括其他波段。
        ///   <bulletList>
        ///     <bullet_item>选中—结果中将包括其他波段。处理波段参数中指定的初始分割波段的分割和顶点信息也将拟合到多波段影像中的其余波段。模型结果将首先包括分割波段，然后是其余波段。 </bullet_item><para/>
        ///     <bullet_item>未选中—结果中将不包括其他波段。这是默认设置。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Include Other Bands")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _output_other_bands_value _output_other_bands { get; set; } = _output_other_bands_value._false;

        public enum _output_other_bands_value
        {
            /// <summary>
            /// <para>INCLUDE_OTHER_BANDS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("INCLUDE_OTHER_BANDS")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>EXCLUDE_OTHER_BANDS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("EXCLUDE_OTHER_BANDS")]
            [GPEnumValue("false")]
            _false,

        }

        public AnalyzeChangesUsingLandTrendr SetEnv(object cellSize = null, object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object nodata = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object pyramid = null, object rasterStatistics = null, object resamplingMethod = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(cellSize: cellSize, compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, nodata: nodata, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, pyramid: pyramid, rasterStatistics: rasterStatistics, resamplingMethod: resamplingMethod, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}